<!--
 - Author : chenyliu.
 - Date   : 2016/9/2.
 - File   : app.vue.
 -->

<template>

  <div class="login" v-if="!$route.frame">
    <router-view></router-view>
  </div>
  <div class="wrapper" v-if="$route.frame">
    <topbar :logout="logout" :name="name"></topbar>
    <div class="main-wrapper">
      <div class="main-content">
        <router-view></router-view>
      </div>
    </div>
  </div>

</template>

<script>
  import Vue from 'vue';
  import Topbar from './components/topbar';
  import vModal from './components/modal';

  import {token} from './vuex/getter';

  export default {
    data() {
      return {
        name:''
      }
    },
    ready(){
    },
    methods: {
      logout() {
        var self = this
        vModal.confirm({
          title: '确认?',
          content: `确认退出当前用户吗?`,
          onOk: function() {
            self.$router.go('/login')
          }
        });
      }
    },
    components: {
      Topbar
    },
    vuex: {
      getters: {
        token
      },
      actions: {
      }
    }
  }
</script>

<style style="less">
 @import "/assets/less/common.less";
</style>
